﻿using System;
using System.Linq;
using System.Threading;

namespace Sparrow.CMS
{
    using Sparrow.Web.Router;

    public  static class WebRouterExtension
    {
        public static PageContent FindContent(this WebRouter router)
        {
            return router.FindContent(Thread.CurrentThread.CurrentCulture.Name);
        }

        public static PageContent FindContent(this WebRouter router,string culture)
        {
            var content = Facotry.Provider.FindContent(router, culture);

            if (content != null)
            {
                content.WebRouter = router;
            }

            return content;
        }
    }
}
